<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<!DOCTYPE html>
<html lang="zh-CN" >
<head>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>新增厂商账号</title>
<jsp:include page="../../import.jsp" flush="true" />
	<script type="text/javascript" src="<%=path %>/resource/lib/plugins/ajaxfileupload.js"></script>

</head>
<body class="iframeBody">
<div class="Wrapper">
	<form id="formSet1">
		<div class="fieldset1 tabel_col clearFix">
			<div class="fieldBox col_50">
				<div class="label">账号类型</div>
				<div class="field">
					<select name="bizTypCd" id="bizTypCd" data-value=" "  validate ="{required:true,select:true}">
						<option value=" " checked >请选择</option>
						<c:forEach items="${bizTypCdList }" var="kv">
							<option value="${kv.key }">${kv.value }</option>
						</c:forEach>
					</select>
					<span class="requiredSymbol">*</span>
				</div>
			</div>
			<div class="fieldBox col_50">
                <div class="label">收款方</div>
                <div class="field">
                	<input type="text" id="rcptUnt" name="rcptUnt" class="ui-textbox" validate ="{required:true}"/>
                	<span class="requiredSymbol">*</span>
                </div>
            </div>
			<div class="fieldBox col_50">
                <div class="label">收款账号</div>
                <div class="field">
                	<input type="text" id="accNo" name="accNo" class="ui-textbox" validate ="{required:true,number:true}"/>
                	<span class="requiredSymbol">*</span>
                </div>
            </div>
			<div class="fieldBox col_50">
                <div class="label">开户行</div>
                <div class="field">
                	<input type="text" id="bkNm" name="bkNm" class="ui-textbox" validate ="{required:true}"/>
                	<span class="requiredSymbol">*</span>
                </div>
            </div>
			<div class="fieldBox col_50">
                 <div class="label">开户行行号</div>
                 <div class="field">
                 	<input type="text" id="bkNo" name="bkNo" class="ui-textbox" validate ="{required:true,number:true}"/>
                 	<span class="requiredSymbol">*</span>
                 </div>
			</div>
			<div class="fieldBox col_50 isPrivate">
				<div class="label">银行预留手机号</div>
				<div class="field">
					<input type="text" id="bkResTel" name="bkResTel" class="ui-textbox" validate ="{number:true}"/>
					<span class="requiredSymbol">*</span>
				</div>
			</div>
			<div class="fieldBox col_50 isPrivate">
				<div class="label">收款方身份证号</div>
				<div class="field">
					<input type="text" id="certNo" name="certNo" class="ui-textbox"/>
					<span class="requiredSymbol">*</span>
				</div>
			</div>
			<div class="fieldBox col_50">
				<div class="label">联系方式</div>
				<div class="field">
					<input type="text" id="contTel" name="contTel" class="ui-textbox"/>
					<span id="contTelSpan" class="requiredSymbol" style="display: none">*</span>
				</div>
			</div>
			<div class="fieldBox col_66_auto">
                 <div class="label">区域</div>
                 <div class="field">
                 	<jsp:include page="../../system/sysRegion/region.jsp" flush="true" >
						<jsp:param name="regionShowLvl" value="2"/>
					</jsp:include>
                 </div>
			</div>

			<div class="fieldBox col_50">
				<div class="label">账户用途</div>
                    <div class="field">
                        <%-- <select name="purpCd" id="purpCd" data-value=" " validate ="{required:true,select:true}">
                        	<option value=" " checked >请选择</option>
							<c:forEach items="${purpCdList }" var="kv">
							    <option value="${kv.key }">${kv.value }</option>
							</c:forEach>
						</select> --%>
						<input type="text" id="purpCd" name="purpCd" validate="{required:true}" onchange="purpCdChange();" ltype="combobox"/>
						<span class="requiredSymbol">*</span>
                    </div>
			</div>
			<div class="fieldBox col_100">
				<div class="label">备注</div>
					<div class="field">
						<input type="text" id="bkRem" name="bkRem" class="ui-textbox" />
					</div>
			</div>
			<c:if test="${isFlow==1 }">
                <div class="fieldBox col_100">
                    <div class="label">厂商</div>
                    <div class="field">
                    	<a href="javascript:showMfrDetail()" class="link">
                   			<span id="mfrNm" name="mfrNm">${mfrNm }</span>
                    	</a>
                    	<input name="mfrId" id="mfrId" type="hidden" value="${mfrId }">
                    </div>
                </div>
               </c:if>
				<div class="splBizFlowPanel">
					<div class="fieldset1 tabel_col clearFix">
						<div class="sqPanel">
							<div class="sqPanel_head inL">
								<span>账号资料信息</span>
								<span class="btns"><span class="sq-button sq-button-round" onclick="downloadSplFileByUrl();">打包下载</span></span>
							</div>
							<div class="sqPanel_body">
								<div id="mfrAccFileInfoCfgGrid" class="sq-grid" style="display: block"></div>
							</div>
						</div>
					</div>
				</div>
			<input name="bkId" id="bkId" type="hidden" value="${id }">
		</div>
		<div class="btnsBox">
            <c:if test="${isFlow == 1 }">
            <!-- 新增是弹出框 附加信息引用的时候没有保存按钮 所以在这里加一个 -->
	            <span id="saveBtn1" class="sq-button sq-button-round" onclick="save();">保存</span>
            </c:if>
        </div>
</form>
</div>


<script type="text/javascript">
	var _mfrId = '${mfrId}';
	var id = '${id}';
	var disable = '${disable}';
	var bizTypCd = '${bizTypCd}';
	var mfrAccFileInfoCfgGrid = null ;
    var _cfgSysCd ; //附件系统CODE
    var _cfgOrgCd ; //附件组织架构
    var _tabNm ; //附件对应表
    var _cfgCd ; //附件CODE
    var _modulePath ;
    var _costomerPath ;
    var _rootPath ;
    var _uploadSysCd ;
	var _mfrBankAccId = '${id}';
    var upload_result_params = [];
    var serverPrefixPath = "";
    var isFlow = '${isFlow}';

	$(function(){
        //获取服务器路径前缀
        $.ajax({
            type: 'get',
            url: '<%=path%>/system/sysulfilesrec/getServerPath.do',
            success:function(msg){
                serverPrefixPath = msg;
                console.log(serverPrefixPath);
            }
        });

		var _purpCdListJSON =  ${purpCdListJSON};
		$("#purpCd").ligerComboBox({ isShowCheckBox: true, isMultiSelect: true,
	        data: _purpCdListJSON,
	        valueField: 'key',
	        textField:'value',
	        onChangeValue :function(value){
	        }
	    });
		
		initData();
		if(id == ""){//新增
	    	$("#fileModify").remove();//移除资料DIV
	    }
		var formSet1 = $('#formSet1').ligerForm({
			validate : true
		});
		/* formSet1.setFieldValidate("rgnProvCd", {
	        required: true,
	        select: false
	    });
		formSet1.setFieldValidate("rgnCityCd", {
	        required: true,
	        select: false
	    }); */
	    if(disable==1){
	    	//禁用除用途字段
	    	disableFeild();
	    }
        bizTypCdChange();

        mfrAccFileInfoCfgGrid = $("#mfrAccFileInfoCfgGrid").ligerGrid({
            url: '<%=path%>/product/splApplyInfo/initSplApplyFileInfoList.do',//?applyId='+_mfrBankAccId+'&cfgCd='+_cfgCd +'&tabNm='+_tabNm +"&cfgSysCd="+_cfgSysCd+'&cfgOrgCd='+_cfgOrgCd+'&uploadSysCd='+_uploadSysCd,
            method: 'get',
            parms: {applyId: _mfrBankAccId,cfgCd:_cfgCd,tabNm: _tabNm,cfgSysCd:_cfgSysCd,uploadSysCd:_uploadSysCd},
            columns: [
                {display: '资料名称', name: 'datNm',align: 'left', minWidth: 100, enabledSort: false},
                {display: '上传文件名称', name: 'fileNm',align: 'left', minWidth: 100, enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        if(value){
                            var h;
                            h='<a href="javascript:uploadFileByUrl(';
                            h+="'"+rowdata.filePath+"'";
                            h+=",'"+rowdata.fileNm+"'";
                            h+=')">'+rowdata.fileNm+'</a>'
                            return h;
                        }
                    }
                },
                {display: '上传文件路径', name: 'filePath',align: 'left', minWidth: 100,hide:true},
                {display: '上传文件明细', name: 'cfgDtlCd',align: 'left', minWidth: 100,hide:true},
                {display: '上传时间', name: 'crtTm',align: 'left', minWidth: 100, enabledSort: false,render:renderDate},
                {display: '状态', name: 'audStsCdNm', width: 100, enabledSort: false},
                {display: '操作', name: '', minWidth: 200,align: 'left',  enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        var h='';
                        if(rowdata.audStsCd){
                            if(rowdata.fileId) {
                                h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="delFile(event,' + rowdata.fileId + ');"><i class="sqBtnIco_7"></i>删除</a>';
                            }else{
                                h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="delUpLoadindFile(event,' + rowindex +','+rowdata.cfgDtlCd+');"><i class="sqBtnIco_7"></i>删除</a>';
                            }
                        }else{
                            h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="delUpLoadindFile(event,' + rowindex + ','+rowdata.cfgDtlCd+');"><i class="sqBtnIco_7"></i>删除</a>';
                        }
                        return h;
                    }
                },
                {display: '上传', name: 'uploadNm', width: 80,align: 'left', enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        var h='';
                        if(rowdata.fileId){

                        }else{
                            h+='<span class="sq-button sq-button-round fileupload-button">上传<input type="file" id="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'" multiple name="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'"' +
                                ' class="fileupload-input" onchange="onChangefile_multi(event,\''+rowdata.cfgCd+'\',\''+rowdata.cfgDtlCd+'\',\''+rowdata.orgCd+'\',\''+rowdata.fileId+'\',\''+rowindex+'\')"></span>';
                        }
                        return h;
                    }
                },
            ],
            root: 'rows',
            hideLoadButton : true,
            width: '100%',
            height: '100%',
            isScroll: false,
            rownumbers:true,  //显示序号
            checkbox: false,
            allowUnSelectRow:true,
            alternatingRow: false,
            frozen: false,
            usePager: false,
            onAfterShowData: function ()
            {
                $('#mfrAccFileInfoCfgGrid').rowspan('datNm');
                $('#mfrAccFileInfoCfgGrid').rowspan('uploadNm');
            },
        });

	});

	//定义父级调用事件
	if(!isFlow || isFlow != '1'){
        frameElement.dialog.onOk = function () {
            save();
        }

        frameElement.dialog.onCancel = function () {
            frameElement.dialog.close();
        }
	}
	
	//禁用除用途外字段  移除资料部分
	function disableFeild(){
		if(liger.get("rcptUnt")){
			liger.get("rcptUnt").setDisabled(true);
		}
		if(liger.get("accNo")){
			liger.get("accNo").setDisabled(true);
		}
		if(liger.get("bkNm")){
			liger.get("bkNm").setDisabled(true);
		}
		if(liger.get("bkNo")){
			liger.get("bkNo").setDisabled(true);
		}
		disabledRgnProvCd();//禁用区域
		disabledRgnCityCd();
		if(liger.get("bizTypCd")){
			liger.get("bizTypCd").setDisabled(true);
		}
		if(liger.get("bkRem")){
			liger.get("bkRem").setDisabled(true);
		}
		if(liger.get("contTel")){
			liger.get("contTel").setDisabled(true);
		}
		$("#fileDIV").remove();
		$("#fileUploadDIV").remove();
		$("#noticeDIV").remove();
        $(".isPrivate").remove();
	}
	
	function bizTypCdChange(){
        if(bizTypCd==0){
            //账号类型对公
            $("#noticeDIV").show();
            $(".isPrivate").css('display','none');
            $("#bkResTel").rules('remove','required')
            $("#certNo").rules('remove','required')
        }else{
            //账号类型对私
            $("#noticeDIV").hide();
            $(".isPrivate").css('display','block');
            $("#bkResTel").rules("add",{required:true})
            $("#certNo").rules("add",{required:true})
        }
        $("#bizTypCd").change(function(event) {
            bizTypCd = $("#bizTypCd").val();
            if(bizTypCd==0){
                //账号类型对公
                $("#noticeDIV").show();
                $(".isPrivate").css('display','none');
                $("#bkResTel").rules('remove','required')
                $("#certNo").rules('remove','required')
            }else{
                //账号类型对私
                $("#noticeDIV").hide();
                $(".isPrivate").css('display','block');
                $("#bkResTel").rules("add",{required:true})
                $("#certNo").rules("add",{required:true})
            }
        });
	}
	function save(){
		var form = liger.get("formSet1");
	    if (!form.valid()) {
	    	$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO , SQ_type: "warning" });
	        return false; //验证不通过，不执行以下代码
	    }
	    
	    var data = form.getData();
	    var id = $("#bkId").val();
	    data["mfrId"] = _mfrId;
	    var fileParams = upload_result_params;//获取附件上传的信息
	    data["fileParams"] = JSON.stringify(fileParams);
	    data["rgnPrCd"] = getRgnProvCd();//获取省代码
	    data["rgnCyCd"] = getRgnCityCd();//获取市代码
	    
	    var url = '<%=path%>/mfr/mfrbankacc/add.do';
	    if(id != ""){
	    	url = '<%=path%>/mfr/mfrbankacc/modify.do';
	    	data["id"]= id;
            data["disable"]= disable;
	    }
	    var wait_dialog;
	    $.ajax({
			type: 'post',
			dataType:'json',
			data:data,
			url: url,
			beforeSend: function(){
		          wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
		     },
			success:function(msg){
				 wait_dialog.close();
				 if(msg.success == 1){
					 $.ligerDialog.SQalert({content:msg.info, SQ_type: "success"});
		             parent.callback();
		             frameElement.dialog.close();
				 }else{
					 $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
				 }
			}
		});
	}
	function initData(){
		var id = $("#bkId").val();
    	if(!id){
    		return;
    	}
    	var _url = '<%=path%>/mfr/mfrbankacc/getById.do';
    	$.ajax({
    		type: 'get',
    		dataType:'json',
    		data:{id:id},
    		url: _url,
    		success:function(msg){
    			 if(msg.success == 1){
    				 setData(msg.data);//设置数据
    			 }else{
    				 $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
    			 }
    		}
    	});
   	}
		
	//设置页面数据
    function setData(data){
		//根据账号的审核状态设置字段是否可用
		var audStsCdNm = data.mfrBankAccVO.audStsCdNm;
		if(audStsCdNm==CommonConstant.C_AUD_ADNWAY_CODE||audStsCdNm==CommonConstant.C_AUD_PASS_CODE){
			//设置一些重要字段不可操作  setReadonly
			liger.get("rcptUnt").setDisabled();
			liger.get("accNo").setDisabled();
			liger.get("bkNm").setDisabled();
			liger.get("bkNo").setDisabled();
			liger.get("bizTypCd").setDisabled();
			liger.get("rgnProvCd").setDisabled();
			liger.get("rgnCityCd").setDisabled();
            liger.get("certNo").setDisabled();
            liger.get("bkResTel").setDisabled();
		}
    	var form = liger.get("formSet1");
    	form.setData({
    		bizTypCd:data.mfrBankAccVO.bizTypCd,
    	});
    	//区域数据处理
    	setRgnProvCdUpdataValue(data.mfrBankAccVO.rgnPrCd);
    	setRgnCityCdUpdataValue(data.mfrBankAccVO.rgnCyCd);
    	setRegionSelectDataChange();
    	
    	$("#rcptUnt").val(data.mfrBankAccVO.rcptUnt);
    	$("#accNo").val(data.mfrBankAccVO.accNo);
    	$("#bkNm").val(data.mfrBankAccVO.bkNm);
    	$("#bkNo").val(data.mfrBankAccVO.bkNo);
    	$("#bkRem").val(data.mfrBankAccVO.bkRem);
    	$("#contTel").val(data.mfrBankAccVO.contTel);
        $("#certNo").val(data.mfrBankAccVO.certNo);
        $("#bkResTel").val(data.mfrBankAccVO.bkResTel);
    	
    	$("#purpCd").ligerGetComboBoxManager().selectValue(data.mfrBankAccVO.purpCd);
    	$("#purpCd").ligerGetComboBoxManager().updateStyle();

        _cfgSysCd = data.cfgSysCd; //附件系统CODE
		_cfgOrgCd = data.cfgOrgCd; //附件组织架构
        _tabNm = data.tabNm; //附件对应表
        _cfgCd = data.cfgCd; //附件CODE
        _modulePath = data.modulePath;
        _costomerPath = data.costomerPath;
        _rootPath = data.rootPath;
        _uploadSysCd = data.uploadSysCd;
        _mfrBankAccId = data.id;

        mfrAccFileInfoCfgGrid.setParm("cfgSysCd",_cfgSysCd);
        mfrAccFileInfoCfgGrid.setParm("cfgCd",_cfgCd);
        mfrAccFileInfoCfgGrid.setParm("tabNm",_tabNm);
        mfrAccFileInfoCfgGrid.setParm("cfgSysCd",_cfgSysCd);
        mfrAccFileInfoCfgGrid.setParm("uploadSysCd",_uploadSysCd);
        mfrAccFileInfoCfgGrid.reload();
	};

	function showMfrDetail(){
		var mfrId = $("#mfrId").val();
		if(StringUtils.isNotEmpty(mfrId)){
			Add_navTab('mfrInfo'+mfrId,'厂商详情','<%=path%>/mfr/mfrBscIfo/toDetailPage.do?id='+mfrId);
		}
	}

	var currOrgCd = '${currOrgCd}';
	function purpCdChange(){
		var orgcd = currOrgCd.substring(0,12);
		if(orgcd=="000000080002"){
			var purpCd = liger.get("purpCd").getValue();
			if(purpCd.indexOf(CommonConstant.C_SPL_PURP_CD_2)>-1){
				var formSet1=liger.get("formSet1");
				formSet1.setFieldValidate("contTel", {
			        required: true
			    });
				$("#contTelSpan").show();
			}else{
				var formSet1=liger.get("formSet1");
				formSet1.setFieldValidate("contTel", {
			        required: false
			    });
				$("#contTelSpan").hide();
			}
		}
	}

    /**
	 * 修改账户类型
     * @param val
     */
	function modifyBizTypCd(val) {
		var _bizTypCd = val.trim() ;
		if(val && "9999" != _bizTypCd && val.length > 0){
            console.log("modifyBizTypCd val ="+val+"_bizTypCd="+_bizTypCd);
		    //SPL0005 账号类型 0：对公，1：对私
            $("#mfrAccFileInfoCfgGrid").css("display","block");
            $.ajax({
                type: 'post',
                dataType: 'json',
                data: {bizTypCd: _bizTypCd},
                url: '<%=path%>/mfr/mfrbankacc/getFileCfgInfo.do',
                success: function (msg) {
                    if (msg.success == 1) {
                        console.log("msg.data =="+JSON.stringify(msg.data))
                        _cfgSysCd = msg.data.cfgSysCd; //附件系统CODE
                        _cfgOrgCd = msg.data.cfgOrgCd; //附件组织架构
                        _tabNm = msg.data.tabNm; //附件对应表
                        _cfgCd = msg.data.cfgCd; //附件CODE
                        _modulePath = msg.data.modulePath;
                        _costomerPath = msg.data.costomerPath;
                        _rootPath = msg.data.rootPath;
                        _uploadSysCd = msg.data.uploadSysCd;
                        console.log("_uploadSysCd =="+JSON.stringify(_uploadSysCd))
                        //parms: {applyId: _mfrBankAccId,cfgCd:_cfgCd,tabNm: _tabNm,cfgSysCd:_cfgSysCd,uploadSysCd:_uploadSysCd},
                        mfrAccFileInfoCfgGrid.setParm("cfgSysCd",_cfgSysCd);
                        mfrAccFileInfoCfgGrid.setParm("cfgCd",_cfgCd);
                        mfrAccFileInfoCfgGrid.setParm("tabNm",_tabNm);
                        mfrAccFileInfoCfgGrid.setParm("cfgSysCd",_cfgSysCd);
                        mfrAccFileInfoCfgGrid.setParm("uploadSysCd",_uploadSysCd);
                        mfrAccFileInfoCfgGrid.reload();
                    } else {
                        $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                    }
                }
            });
		}
    }

    //删除文件
    function delFile(event,_fileId){
        top.$.ligerDialog.confirm("确认删除吗?", function (flag) {
            if(!flag){
                return;
            }else{
                var wait_dialog;
                $.ajax({
                    type: 'post',
                    dataType: 'json',
                    data: {'fileId':_fileId},
                    url: '<%=path%>/product/splInfo/removeFile.do',
                    beforeSend: function () {
                        wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
                    },
                    success: function (msg) {
                        wait_dialog.close();
                        if (msg.success == 1) {
                            $.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                            event.stopPropagation();
                            clearUploadResultParams();//清除上传结果参数
                            mfrAccFileInfoCfgGrid.reload();
                        }else{
                            $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                        }
                    }
                });
            }
        });
    }

    function onChangefile_multi(e,cfgCd,cfgDtlCd,orgCd,fileId,rowIndex) {
        console.log("e == " + JSON.stringify(e) +",rowIndex==" + rowIndex);
        var wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
        var filePath= _modulePath; //之前无 '/'
        console.log("filePath ==="+filePath);
        $.ajaxFileUpload({
            url: '<%=path%>/system/sysulfilesrec/upload.do',
            secureuri: false,
            fileElementId: e.target.id,  //这里不在是以前的id了，要写成数组的形式！
            dataType: 'json',
            data: {filePath: filePath,costomerPath:_costomerPath,rootPath:_rootPath,uploadSysCd:_uploadSysCd},
            success: function (msg) {
                if (msg.success == 1) {
                    if(serverPrefixPath.length >1 && serverPrefixPath.indexOf("\"")>=0){
                        serverPrefixPath = serverPrefixPath.substring(1,serverPrefixPath.length-1);
                    }
                    var uploadJOSN = JSON.parse(JSON.stringify(msg.data));
                    console.log("uploadJOSN =s= " + JSON.stringify(uploadJOSN));
                    for (var i=0; i< uploadJOSN.length; i++){
                        var oldPath = "";
                        var newPath = "";
                        oldPath = uploadJOSN[i].filePath;
                        newPath = serverPrefixPath + oldPath;
                        //uploadJOSN[i].filePath = newPath;
                        mfrAccFileInfoCfgGrid.updateCell("filePath",oldPath,rowIndex);
                        mfrAccFileInfoCfgGrid.updateCell("fileNm",uploadJOSN[i].fileNm,rowIndex);
                        mfrAccFileInfoCfgGrid.updateCell("cfgDtlCd",cfgDtlCd,rowIndex);
                        mfrAccFileInfoCfgGrid.updateCell("crtTm",new Date(),rowIndex);
                        uploadJOSN[i].cfgCd = cfgCd ;
                        uploadJOSN[i].cfgDtlCd = cfgDtlCd;
                        uploadJOSN[i].orgCd = orgCd;
                        uploadJOSN[i].tabNm = _tabNm;
                        uploadJOSN[i].sysCd = _cfgSysCd;
                        upload_result_params.push(uploadJOSN[i]);
                        console.log("upload_result_params =s= " + JSON.stringify(upload_result_params));
                    }
                    wait_dialog.close();
                } else {
                    wait_dialog.close();
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                }
            }
        });
    };

    //删除文件
    function delUpLoadindFile(event,rowIndex,cfgDtlCd){
        top.$.ligerDialog.confirm("确认删除吗?", function (flag) {
            if(!flag){
                return;
            }else{
                var wait_dialog;
                wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
                for (var i=0; i< upload_result_params.length; i++){
                    if(upload_result_params[i].cfgDtlCd == cfgDtlCd){
                        console.log("cfgDtlCd =j= " + cfgDtlCd);
                        upload_result_params.splice(i,1);
                        break;
                    }
                }
                mfrAccFileInfoCfgGrid.updateCell("filePath",'',rowIndex);
                mfrAccFileInfoCfgGrid.updateCell("fileNm",'',rowIndex);
                mfrAccFileInfoCfgGrid.updateCell("crtTm",'',rowIndex);
                console.log("upload_result_params =k= " + JSON.stringify(upload_result_params));
                wait_dialog.close();
            }
        });
    }

    function downloadSplFileByUrl() {
        var data = mfrAccFileInfoCfgGrid.getData();
        //var files = [];
        var ids = [];
        for (var i = 0; i < data.length; i++) {
            var map = {};
            if(StringUtils.isNotEmpty(data[i].fileId)){
                ids.push(data[i].fileId);
            }
        }
        var actoinURL = '<%=path%>/system/sysulfilesrec/zipDownloadById.do?';
        var form = $("<form>");
        $('body').append(form);
        form.attr('style','display:none');
        form.attr('target','');
        form.attr('method','post');
        form.attr('action',actoinURL);//下载文件的请求路径
        var input = $('<input>');
        input.attr('type','hidden');
        input.attr('name','ids');
        input.attr('value',JSON.stringify(ids));
        form.append(input);
        form.submit();
    }

    //格式化时间
    function renderDate(rowdata, index, value) {
        var dateStr = "";
        if (null != value && ''!= value) {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
        }
        return dateStr;
    }

    function uploadFileByUrl(_url,_name){
        if(serverPrefixPath.length >1 && serverPrefixPath.indexOf("\"")>=0){
            serverPrefixPath = serverPrefixPath.substring(1,serverPrefixPath.length-1);
        }
        if(SQ.regs.img.test(_name)){
            if(_url.indexOf('http') != -1){
                window.__ImgSrc =  _url;
			}else{
                window.__ImgSrc = serverPrefixPath + _url;
            }
            window.__ImgTit = _name;
            window.open('<%=path%>/project/prjbscinfo/imgWinOpen.do', _name , 'location=yes, width=800, height=600');
        }else{
            if(_url.indexOf('http') != -1){
                window.open( _url);
            }else{
                window.open(serverPrefixPath + _url);
            }
        }
    }
</script>



</body>
</html>
